--[[处理收到的好友消息

提前收到的声明数据为：
fromqq  消息的qq号码 number类型
message 消息内容     string类型
id      消息id       number类型

注意：拦截消息后请将变量handled置true，表示消息已被拦截，如：
handled = true

下面的代码为我当前接待喵逻辑使用的代码，可以重写也可以按自己需求进行更改
详细请参考readme
]]

--初始化发送消息函数
function sendMessage(m)
    cqSendPrivateMessage(fromqq, m)
end

-- 判断是否激活插件
if admin=="" then
    return require("app.baseinit")(fromqq,message)
end

--记录语音配置
if message:find("%[CQ:record,file=")==1 and message:find("silk") and fromqq == admin or "admin"==apiXmlGet('', 'adminList', tostring(fromqq)) then
    local total = apiXmlGet("record","record","total")
    if total=="" then
        total=0
    end
    total = tonumber(total)+1
    local n = message:gsub("%[CQ:record,file=",""):gsub("%]","")
    apiXmlSet("record","record",tostring(total),n)
    apiXmlSet("record","record","total",tostring(total))
end

-- 监听转发
if apiXmlGet("","Monitorqqlog","Monitor") == "t" and fromqq ~= admin then
    local q = admin
    local cq = apiXmlGet("","Monitorqqlog","qq")
    if cq ~="" then
        q=cq
    end
    cqSendPrivateMessage(tonumber(q),"转发自QQ "..fromqq.."\n内容:\n"..message)
end

-- 获取菜单列表
if message=="菜单" then
    return require("app.menu.private.privatefeatures")(fromqq,message,false)
end


if  fromqq==admin or "admin"==apiXmlGet('', 'adminList', tostring(fromqq)) then
    
    -- 获取设置列表
    if message=="设置" then
        return require("app.menu.private.privatemanage")(fromqq,message,false)
    end

    -- 执行设置功能
    if require("app.menu.private.privatemanage")(fromqq,message,true) then
        return true
    end
end

-- 执行菜单功能
if require("app.menu.private.privatefeatures")(fromqq,message,true) then
    return true
end


-- 消息回复
return require("app.menu.private.messageprivateSolve")(fromqq,message)
